<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>vue 组件化</title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<input type="text" name="" id="" value="" v-model="inputValue" />	
			<button type="button" v-on:click="btnClick">提交</button>
			<ul>
				<todo-item v-bind:content="item" 
						   v-for="item in list">
				</todo-item>
			</ul>
		</div>
	</body>
	<script type="text/javascript">
		//全局组件
		Vue.component("todo-item",
		{
			props: ['content'],
			template: "<li>{{content}}</li>"
		})
		//局部
		var TodoItem = {
			props: ['content'],
			template: "<li>{{content}}</li>"
		}
		var app = new Vue({
			el: '#app',
// 			components: {
// 				TodoItem: TodoItem
// 			},
			data: {
				list: [],
				inputValue:""
			},
			methods: {
				btnClick: function(){
					this.list.push(this.inputValue)
					this.inputValue=""
				}
			}
		})
	</script>
</html>